home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / CHIP 2005-06.iso / program / web / kmsetup.exe / {app} / Bin / kcomponents6.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2005-02-07  |  49.4 KB  |  1,748 lines

  1. _global.krecordset = function()
  2. {
  3.    this.filename = "xmlquery.php";
  4. };
  5. krecordset.prototype.setdatabridge = function(filename)
  6. {
  7.    this.filename = filename;
  8. };
  9. krecordset.prototype.query = function(query)
  10. {
  11.    this.records = new array();
  12.    this.sqlxml = new xml();
  13.    this.sqlxml._parent = this;
  14.    this.sqlxml.ignorewhite = true;
  15.    this.sqlxml.onload = function()
  16.    {
  17.       if(this.childnodes[0].nodename == "recordset")
  18.       {
  19.          var i = 0;
  20.          while(i < this.childnodes[0].childnodes.length)
  21.          {
  22.             var record = this.childnodes[0].childnodes[i];
  23.             var recordobject = new object();
  24.             var j = 0;
  25.             while(j < record.childnodes.length)
  26.             {
  27.                recordobject[record.childnodes[j].nodename] = record.childnodes[j].firstchild.nodevalue;
  28.                j++;
  29.             }
  30.             this._parent.records.push(recordobject);
  31.             i++;
  32.          }
  33.          this._parent.onqueried();
  34.       }
  35.    };
  36.    this.sqlxml.load(this.filename + "?query=" + query);
  37. };
  38. op = object.prototype;
  39. op.$protect = function(pr)
  40. {
  41.    if(arguments.length == 0)
  42.    {
  43.       pr = null;
  44.    }
  45.    assetpropflags(this,pr,7);
  46. };
  47. op.getpropertiesfrom = function(fo)
  48. {
  49.    var pr;
  50.    for(pr in "fo")
  51.    {
  52.       this[pr] = fo[pr];
  53.    }
  54. };
  55. op.$protect();
  56. delete op;
  57. _global.kobject = function()
  58. {
  59. };
  60. kobject.__classes__ = [];
  61. kobject.registerclass = function(symbolid, theclass)
  62. {
  63.    this.__classes__[symbolid] = theclass;
  64. };
  65. movieclip.prototype.kconvertmc = function(idname, initobject)
  66. {
  67.    this.intervalid = "nop";
  68.    this.getpropertiesfrom(initobject);
  69.    this.__proto__ = kobject.__classes__[idname].prototype;
  70.    kobject.__classes__[idname].apply(this);
  71. };
  72. movieclip.prototype.kattachmovie = function(idname, newname, depth, initobject)
  73. {
  74.    this.createemptymovieclip(newname,depth);
  75.    this[newname].kconvertmc(idname,initobject);
  76. };
  77. _global.kstyleformat = function(style)
  78. {
  79.    var kss = style != null ? style.tolowercase() : _global.kstyleformat.style.tolowercase();
  80.    var ks = [15790320,16777215,0,8421504,8421504,false,false,8421504,14211288,11579568,6316128,false,0,"verdana, helvetica",16777215,12];
  81.    if(kss == "aqua")
  82.    {
  83.       ks = [16777215,14417919,2368682,2387455,4840277,true,true,2387455,14408703,2415615,2387455,true,0,"verdana, helvetica",16777215,12];
  84.    }
  85.    else if(kss == "desert")
  86.    {
  87.       ks = [16777130,16767914,2359296,7162112,11955456,true,false,7162112,14408533,14389760,7152640,true,0,"verdana, helvetica",16777215,12];
  88.    }
  89.    else if(kss == "invgreen")
  90.    {
  91.       ks = [9216,9216,2405888,11992917,46592,false,true,11992917,2368512,7180800,9633536,false,16777215,"verdana, helvetica",0,12];
  92.    }
  93.    else if(kss == "nature")
  94.    {
  95.       ks = [7143424,16777130,4793344,7143424,14380288,true,true,7143424,16767914,4840192,11946240,true,0,"verdana, helvetica",16777215,12];
  96.    }
  97.    this.arrow = ks[0];
  98.    this.background = ks[1];
  99.    this.border = ks[2];
  100.    this.check = ks[3];
  101.    this.face = ks[4];
  102.    this.gradient = ks[5];
  103.    this.liquid = ks[6];
  104.    this.radiodot = ks[7];
  105.    this.scrolltrack = ks[8];
  106.    this.scrollbar = ks[9];
  107.    this.selection = ks[10];
  108.    this.shaded = ks[11];
  109.    this.textcolor = ks[12];
  110.    this.textfont = ks[13];
  111.    this.textselected = ks[14];
  112.    this.textsize = ks[15];
  113. };
  114. _global.kcomponent = function()
  115. {
  116. };
  117. kcomponent.prototype = new movieclip();
  118. kcomponent.prototype.usehandcursor = false;
  119. kcomponent.prototype.kdrawtbox = function(tl_x, tl_y, br_x, br_y)
  120. {
  121.    this.clear();
  122.    this.linestyle();
  123.    this.beginfill(0,0);
  124.    this.moveto(tl_x,tl_y);
  125.    this.lineto(br_x,tl_y);
  126.    this.lineto(br_x,br_y);
  127.    this.lineto(tl_x,br_y);
  128.    this.endfill();
  129. };
  130. kcomponent.prototype.kdrawliquidbox = function(tl_x, tl_y, br_x, br_y, cf)
  131. {
  132.    this.clear();
  133.    this.linestyle();
  134.    var c1 = this.ksubcolor(cf,80,80,80);
  135.    var c2 = this.ksubcolor(cf,24,24,24);
  136.    if(this.pressing)
  137.    {
  138.       c2 = this.ksubcolor(c2,16,16,16);
  139.    }
  140.    else if(this.rover)
  141.    {
  142.       c2 = this.kaddcolor(c2,16,16,16);
  143.    }
  144.    var c3 = this.ksubcolor(cf,64,64,64);
  145.    var colors = [c3,c2,c2,c1];
  146.    var alphas = [100,100,100,100];
  147.    var ratios = [0,128,175,255];
  148.    var matrix = {matrixtype:"box",r:1.5700000524520874};
  149.    matrix.w = br_x - tl_x;
  150.    matrix.h = br_y - tl_y;
  151.    matrix.x = 0;
  152.    matrix.y = 0;
  153.    this.begingradientfill("radial",colors,alphas,ratios,matrix);
  154.    this.ksubrr(0,0,matrix.w,matrix.h);
  155.    this.endfill();
  156.    var colors = [16777215,16777215,16777215,16777215,cf,cf,cf];
  157.    var alphas = [80,50,30,10,30,60,0];
  158.    var ratios = [0,80,112,176,192,240,255];
  159.    this.begingradientfill("linear",colors,alphas,ratios,matrix);
  160.    this.ksubrr(1,1,matrix.w - 1,matrix.h - 1);
  161.    this.endfill();
  162. };
  163. kcomponent.prototype.kdrawboxfilled = function(tl_x, tl_y, br_x, br_y, cf)
  164. {
  165.    if(this.pressing)
  166.    {
  167.       cf = this.ksubcolor(cf,16,16,16);
  168.    }
  169.    else if(this.rover)
  170.    {
  171.       cf = this.kaddcolor(cf,16,16,16);
  172.    }
  173.    this.linestyle();
  174.    this.moveto(tl_x,tl_y);
  175.    if(this.style.gradient)
  176.    {
  177.       var colors = [this.kaddcolor(cf,32,32,32),this.ksubcolor(cf,32,32,32)];
  178.       var alphas = [100,100];
  179.       var ratios = [0,255];
  180.       var matrix = {matrixtype:"box",r:1.2999999523162842};
  181.       matrix.x = tl_x;
  182.       matrix.y = tl_y;
  183.       matrix.w = br_x - tl_x;
  184.       matrix.h = br_y - tl_y;
  185.       this.begingradientfill("linear",colors,alphas,ratios,matrix);
  186.    }
  187.    else
  188.    {
  189.       this.beginfill(cf);
  190.    }
  191.    this.lineto(br_x,tl_y);
  192.    this.lineto(br_x,br_y);
  193.    this.lineto(tl_x,br_y);
  194.    this.endfill();
  195. };
  196. kcomponent.prototype.kdrawborderedboxfilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
  197. {
  198.    if(this.style.shaded)
  199.    {
  200.       var ctl = this.kaddcolor(cf,32,32,32);
  201.       var cbr = this.ksubcolor(cf,32,32,32);
  202.       if(this.pressing or this.style.sunken)
  203.       {
  204.          var tmp = ctl;
  205.          ctl = cbr;
  206.          cbr = tmp;
  207.       }
  208.       this.kdrawboxfilled(tl_x,tl_y,br_x,br_y,ctl);
  209.       this.kdrawboxfilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
  210.    }
  211.    else
  212.    {
  213.       this.kdrawboxfilled(tl_x,tl_y,br_x,br_y,cb);
  214.    }
  215.    this.kdrawboxfilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
  216. };
  217. kcomponent.prototype.kdrawcirclefilled = function(tl_x, tl_y, br_x, br_y, cf)
  218. {
  219.    if(this.pressing)
  220.    {
  221.       cf = this.ksubcolor(cf,16,16,16);
  222.    }
  223.    else if(this.rover)
  224.    {
  225.       cf = this.kaddcolor(cf,16,16,16);
  226.    }
  227.    var mx = (tl_x + br_x) / 2;
  228.    var my = (tl_y + br_y) / 2;
  229.    var cx = (br_x - tl_x) * 0.02199999988079071;
  230.    var cy = (br_y - tl_y) * 0.02199999988079071;
  231.    this.linestyle();
  232.    if(this.style.gradient)
  233.    {
  234.       var colors = [this.kaddcolor(cf,32,32,32),this.ksubcolor(cf,32,32,32)];
  235.       var alphas = [100,100];
  236.       var ratios = [0,255];
  237.       var matrix = {matrixtype:"box",r:1.2999999523162842};
  238.       matrix.x = tl_x;
  239.       matrix.y = tl_y;
  240.       matrix.w = br_x - tl_x;
  241.       matrix.h = br_y - tl_y;
  242.       this.begingradientfill("linear",colors,alphas,ratios,matrix);
  243.    }
  244.    else
  245.    {
  246.       this.beginfill(cf);
  247.    }
  248.    this.moveto(mx,tl_y);
  249.    this.curveto(br_x - cx,tl_y + cy,br_x,my);
  250.    this.curveto(br_x - cx,br_y - cy,mx,br_y);
  251.    this.curveto(tl_x + cx,br_y - cy,tl_x,my);
  252.    this.curveto(tl_x + cx,tl_y + cy,mx,tl_y);
  253.    this.endfill();
  254. };
  255. kcomponent.prototype.kdrawborderedcirclefilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
  256. {
  257.    if(this.style.shaded)
  258.    {
  259.       var ctl = this.kaddcolor(cf,32,32,32);
  260.       var cbr = this.ksubcolor(cf,32,32,32);
  261.       if(this.pressing or this.style.sunken)
  262.       {
  263.          var tmp = ctl;
  264.          ctl = cbr;
  265.          cbr = tmp;
  266.       }
  267.       this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,ctl);
  268.       this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
  269.    }
  270.    else
  271.    {
  272.       this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,cb);
  273.    }
  274.    this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
  275. };
  276. kcomponent.prototype.kdrawcheckmark = function(tl_x, tl_y, br_x, br_y, cf)
  277. {
  278.    this.linestyle();
  279.    this.moveto(tl_x + 1,tl_y);
  280.    this.beginfill(cf);
  281.    this.lineto(br_x,br_y - 1);
  282.    this.lineto(br_x - 1,br_y);
  283.    this.lineto(tl_x,tl_y + 1);
  284.    this.endfill();
  285.    this.moveto(br_x - 1,tl_y);
  286.    this.beginfill(cf);
  287.    this.lineto(br_x,tl_y + 1);
  288.    this.lineto(tl_x + 1,br_y);
  289.    this.lineto(tl_x,br_y - 1);
  290.    this.endfill();
  291. };
  292. kcomponent.prototype.kdrawborderedcirclefilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
  293. {
  294.    if(this.style.shaded)
  295.    {
  296.       var ctl = this.kaddcolor(cf,32,32,32);
  297.       var cbr = this.ksubcolor(cf,32,32,32);
  298.       if(this.pressing or this.style.sunken)
  299.       {
  300.          var tmp = ctl;
  301.          ctl = cbr;
  302.          cbr = tmp;
  303.       }
  304.       this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,ctl);
  305.       this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
  306.    }
  307.    else
  308.    {
  309.       this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,cb);
  310.    }
  311.    this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
  312. };
  313. kcomponent.prototype.kaddcolor = function(color, r, g, b)
  314. {
  315.    var cb = math.min(255,color % 256 + b);
  316.    var cg = 256 * math.min(255,math.floor(color / 256) % 256 + g);
  317.    var cr = 65536 * math.min(255,math.floor(color / 65536) % 256 + r);
  318.    return cr + cg + cb;
  319. };
  320. kcomponent.prototype.ksubcolor = function(color, r, g, b)
  321. {
  322.    var cb = math.max(0,color % 256 - b);
  323.    var cg = 256 * math.max(0,math.floor(color / 256) % 256 - g);
  324.    var cr = 65536 * math.max(0,math.floor(color / 65536) % 256 - r);
  325.    return cr + cg + cb;
  326. };
  327. kcomponent.prototype.ksubrr = function(tl_x, tl_y, br_x, br_y)
  328. {
  329.    var r = 0.3499999940395355 * math.min(br_x - tl_x,br_y - tl_y);
  330.    this.moveto(tl_x + r,tl_y);
  331.    this.lineto(br_x - r,tl_y);
  332.    this.curveto(br_x,tl_y,br_x,tl_y + r);
  333.    this.lineto(br_x,br_y - r);
  334.    this.curveto(br_x,br_y,br_x - r,br_y);
  335.    this.lineto(tl_x + r,br_y);
  336.    this.curveto(tl_x,br_y,tl_x,br_y - r);
  337.    this.lineto(tl_x,tl_y + r);
  338.    this.curveto(tl_x,tl_y,tl_x + r,tl_y);
  339. };
  340. textfield.prototype.getvisiblesize = function()
  341. {
  342.    return this.bottomscroll - this.scroll + 1;
  343. };
  344. textfield.prototype.gettotalsize = function()
  345. {
  346.    return this.bottomscroll - this.scroll + this.maxscroll;
  347. };
  348. kcomponent.prototype.kcinit = function()
  349. {
  350.    this.style = new kstyleformat();
  351. };
  352. kcomponent.prototype.refresh = function()
  353. {
  354.    if(this.intervalid == "nop")
  355.    {
  356.       this.intervalid = setinterval(this,"clearRefresh",20);
  357.    }
  358. };
  359. kcomponent.prototype.clearrefresh = function()
  360. {
  361.    if(this.intervalid != "nop")
  362.    {
  363.       clearinterval(this.intervalid);
  364.       this.intervalid = "nop";
  365.    }
  366.    this.krefresh();
  367. };
  368. kcomponent.prototype.setlineheight = function()
  369. {
  370.    this.createtextfield("test",777,0,0,0,0);
  371.    var textformat = new textformat();
  372.    textformat.font = this.style.textfont;
  373.    textformat.size = this.style.textsize;
  374.    this.test.setnewtextformat(textformat);
  375.    this.test.text = " ";
  376.    this.style.lineheight = this.test.textheight;
  377.    this.test.removetextfield();
  378. };
  379. kcomponent.prototype.setsize = function(width, height)
  380. {
  381.    this.width = width;
  382.    this.height = height;
  383.    this.refresh();
  384. };
  385. kcomponent.prototype.setwidth = function(width)
  386. {
  387.    this.width = width;
  388.    this.refresh();
  389. };
  390. kcomponent.prototype.getwidth = function()
  391. {
  392.    return this.width;
  393. };
  394. kcomponent.prototype.setheight = function(height)
  395. {
  396.    this.height = height;
  397.    this.refresh();
  398. };
  399. kcomponent.prototype.getheight = function()
  400. {
  401.    return this.height;
  402. };
  403. kcomponent.prototype.setstyle = function(styleformat, ischild)
  404. {
  405.    this.style.getpropertiesfrom(styleformat);
  406.    if(ischild != true)
  407.    {
  408.       this.setlineheight();
  409.    }
  410.    if(0 < this._children.length)
  411.    {
  412.       var s = 0;
  413.       while(s < this._children.length)
  414.       {
  415.          this[this._children[s]].setstyle(this.style,true);
  416.          s++;
  417.       }
  418.    }
  419.    this.krefresh();
  420. };
  421. kcomponent.prototype.setstyleproperty = function(styleproperty, value)
  422. {
  423.    this.style[styleproperty] = value;
  424.    this.setstyle(this.style);
  425. };
  426. kcomponent.prototype.getstyleproperty = function(styleproperty)
  427. {
  428.    return this.style[styleproperty];
  429. };
  430. kcomponent.prototype.setenabled = function(boolean)
  431. {
  432.    this.enabled = boolean;
  433.    if(0 < this._children.length)
  434.    {
  435.       var s = 0;
  436.       while(s < this._children.length)
  437.       {
  438.          this[this._children[s]].setenabled(this.enabled);
  439.          s++;
  440.       }
  441.    }
  442. };
  443. kcomponent.prototype.getenabled = function()
  444. {
  445.    return this.enabled;
  446. };
  447. kcomponent.prototype.destroy = function()
  448. {
  449.    this.removemovieclip();
  450. };
  451. _global.kdatacomponent = function()
  452. {
  453. };
  454. kdatacomponent.prototype = new kcomponent();
  455. kdatacomponent.prototype.kcinit = function()
  456. {
  457.    this.style = new kstyleformat();
  458.    this.itemlist = new array();
  459.    this.itemid = 0;
  460. };
  461. kdatacomponent.prototype.additemat = function(index, label, value)
  462. {
  463.    if(typeof value != "object")
  464.    {
  465.       var ko = new object();
  466.       ko.value = value;
  467.    }
  468.    else
  469.    {
  470.       ko = value;
  471.    }
  472.    ko.label = label;
  473.    ko._id = this.itemid;
  474.    this.itemid += 1;
  475.    this.itemlist.splice(index,0,ko);
  476.    this.refresh();
  477. };
  478. kdatacomponent.prototype.additem = function(label, value)
  479. {
  480.    this.additemat(this.itemlist.length,label,value);
  481. };
  482. kdatacomponent.prototype.removeitemat = function(index)
  483. {
  484.    this.itemlist.splice(index,1);
  485.    this.list.selected = null;
  486.    this.refresh();
  487. };
  488. kdatacomponent.prototype.removeitemsbylabel = function(label, issubstring)
  489. {
  490.    if(issubstring)
  491.    {
  492.       var i = this.itemlist.length - 1;
  493.       while(i >= 0)
  494.       {
  495.          if(this.itemlist[i].label.indexof(label) + 1)
  496.          {
  497.             this.itemlist.splice(i,1);
  498.          }
  499.          i--;
  500.       }
  501.    }
  502.    else
  503.    {
  504.       var i = this.itemlist.length - 1;
  505.       while(i >= 0)
  506.       {
  507.          if(this.itemlist[i].label == label)
  508.          {
  509.             this.itemlist.splice(i,1);
  510.          }
  511.          i--;
  512.       }
  513.    }
  514.    this.list.selected = null;
  515.    this.refresh();
  516. };
  517. kdatacomponent.prototype.removeitemsbyvalue = function(value, issubstring)
  518. {
  519.    if(issubstring)
  520.    {
  521.       var i = this.itemlist.length - 1;
  522.       while(i >= 0)
  523.       {
  524.          if(typeof this.itemlist[i].value == "string" and this.itemlist[i].value.indexof(value) + 1)
  525.          {
  526.             this.itemlist.splice(i,1);
  527.          }
  528.          i--;
  529.       }
  530.    }
  531.    else
  532.    {
  533.       var i = this.itemlist.length - 1;
  534.       while(i >= 0)
  535.       {
  536.          if(this.itemlist[i].value == value)
  537.          {
  538.             this.itemlist.splice(i,1);
  539.          }
  540.          i--;
  541.       }
  542.    }
  543.    this.list.selected = null;
  544.    this.refresh();
  545. };
  546. kdatacomponent.prototype.removeall = function()
  547. {
  548.    this.itemlist = new array();
  549.    this.list.selected = null;
  550.    this.refresh();
  551. };
  552. kdatacomponent.prototype.replaceitemat = function(index, label, value)
  553. {
  554.    if(this.itemlist[index] != null)
  555.    {
  556.       if(typeof value != "object")
  557.       {
  558.          this.itemlist[index].value = value;
  559.       }
  560.       else
  561.       {
  562.          var tmpid = this.itemlist[index]._id;
  563.          this.itemlist[index] = value;
  564.          this.itemlist[index]._id = tmpid;
  565.       }
  566.       this.itemlist[index].label = label;
  567.    }
  568.    this.refresh();
  569. };
  570. kdatacomponent.prototype.getlength = function()
  571. {
  572.    return this.itemlist.length;
  573. };
  574. kdatacomponent.prototype.getitemat = function(index)
  575. {
  576.    return this.itemlist[index];
  577. };
  578. kdatacomponent.prototype.getitemlabel = function(index)
  579. {
  580.    return this.itemlist[index].label;
  581. };
  582. kdatacomponent.prototype.getitemvalue = function(index)
  583. {
  584.    return this.itemlist[index].value;
  585. };
  586. kdatacomponent.prototype.getitemid = function(index)
  587. {
  588.    return this.itemlist[index]._id;
  589. };
  590. kdatacomponent.prototype.sortitemsbylabel = function(ascending)
  591. {
  592.    this.itemlist.sorton("label");
  593.    if(ascending == false)
  594.    {
  595.       this.itemlist.reverse();
  596.    }
  597.    this.refresh();
  598. };
  599. kdatacomponent.prototype.sortitemsbyvalue = function(ascending)
  600. {
  601.    this.itemlist.sorton("value");
  602.    if(ascending == false)
  603.    {
  604.       this.itemlist.reverse();
  605.    }
  606.    this.refresh();
  607. };
  608. _global.ksubarrow = function()
  609. {
  610.    this.kcinit();
  611.    this.krefresh();
  612. };
  613. ksubarrow.prototype = new kcomponent();
  614. ksubarrow.prototype.direction = "U";
  615. ksubarrow.prototype.size = 16;
  616. ksubarrow.prototype.krefresh = function()
  617. {
  618.    var color = this.style.face;
  619.    this.clear();
  620.    if(this.style.liquid)
  621.    {
  622.       this.kdrawliquidbox(0,0,this.size,this.size,color);
  623.    }
  624.    else
  625.    {
  626.       this.kdrawborderedboxfilled(0,0,this.size,this.size,this.style.border,color);
  627.    }
  628.    var hw = this.size / 2;
  629.    var m1 = this.size / 16 * 2.5;
  630.    var m2 = this.size / 16 * 5.5;
  631.    var kmangles = "LDR";
  632.    var kmangle = 2 / 3 * math.pi;
  633.    var angle = kmangles.indexof(this.direction.touppercase()) * math.pi / 2;
  634.    this.beginfill(this.style.arrow);
  635.    this.moveto(hw - math.cos(angle) * m1,hw + math.sin(angle) * m1);
  636.    this.lineto(hw - math.cos(angle + kmangle) * m2,hw + math.sin(angle + kmangle) * m2);
  637.    this.lineto(hw - math.cos(angle - kmangle) * m2,hw + math.sin(angle - kmangle) * m2);
  638.    this.lineto(hw - math.cos(angle) * m1,hw + math.sin(angle) * m1);
  639.    this.endfill();
  640. };
  641. ksubarrow.prototype.onpress = function()
  642. {
  643.    if(this.pressing != true)
  644.    {
  645.       this.timer = getTimer();
  646.    }
  647.    this.pressing = true;
  648.    this.krefresh();
  649.    this.onclick();
  650. };
  651. ksubarrow.prototype.onrelease = function()
  652. {
  653.    this.pressing = false;
  654.    this.krefresh();
  655. };
  656. ksubarrow.prototype.onreleaseoutside = function()
  657. {
  658.    this.pressing = false;
  659.    this.krefresh();
  660. };
  661. ksubarrow.prototype.onrollover = function()
  662. {
  663.    this.rover = true;
  664.    this.krefresh();
  665. };
  666. ksubarrow.prototype.onrollout = function()
  667. {
  668.    this.rover = false;
  669.    this.krefresh();
  670. };
  671. kobject.registerclass("KSubArrow",ksubarrow);
  672. _global.kscrollbar = function()
  673. {
  674.    this.kcinit();
  675.    this.init();
  676. };
  677. kscrollbar.prototype = new kcomponent();
  678. kscrollbar.prototype.horizontal = false;
  679. kscrollbar.prototype.step = 1;
  680. kscrollbar.prototype.init = function()
  681. {
  682.    this._visible = false;
  683.    this.refresh = this.krefresh;
  684.    this.createemptymovieclip("decrbar",3);
  685.    this.createemptymovieclip("incrbar",4);
  686.    this.decrbar.__proto__ = kcomponent.prototype;
  687.    this.incrbar.__proto__ = kcomponent.prototype;
  688.    this.decrbar.onpress = function()
  689.    {
  690.       var t = this._parent;
  691.       t.object[t.controller] = math.max(t.minvalue,t.object[t.controller] - t.object[t.visiblesize] * (t.object[t.maxvalue] - t.minvalue) / (t.object[t.totalsize] - t.object[t.visiblesize]) + t.step);
  692.    };
  693.    this.incrbar.onpress = function()
  694.    {
  695.       var t = this._parent;
  696.       t.object[t.controller] = math.min(t.object[t.maxvalue],t.object[t.controller] + t.object[t.visiblesize] * (t.object[t.maxvalue] - t.minvalue) / (t.object[t.totalsize] - t.object[t.visiblesize]) - t.step);
  697.    };
  698.    if(this.horizontal)
  699.    {
  700.       this.kattachmovie("KSubArrow","decrValue",1,{direction:"L",_y:2,_x:2});
  701.       this.decrbar._x = 20;
  702.       this.decrbar._y = 0;
  703.    }
  704.    else
  705.    {
  706.       this.kattachmovie("KSubArrow","decrValue",1,{direction:"U",_x:2,_y:2});
  707.       this.decrbar._x = 0;
  708.       this.decrbar._y = 20;
  709.    }
  710.    this.decrvalue.onclick = function()
  711.    {
  712.       var t = this._parent;
  713.       t.object[t.controller] = math.max(t.minvalue,t.object[t.controller] - t.step);
  714.       this.onenterframe = function()
  715.       {
  716.          if(!this.pressing)
  717.          {
  718.             this.onenterframe = null;
  719.          }
  720.          else if(this.timer + 500 < getTimer())
  721.          {
  722.             this.onpress();
  723.          }
  724.       };
  725.       this._parent.refresh();
  726.    };
  727.    if(this.horizontal)
  728.    {
  729.       this.kattachmovie("KSubArrow","incrValue",2,{direction:"R",_y:2,_x:this.object._width - 18});
  730.       this.incrbar._y = 0;
  731.    }
  732.    else
  733.    {
  734.       this.kattachmovie("KSubArrow","incrValue",2,{direction:"D",_x:2,_y:this.object._height - 18});
  735.       this.incrbar._x = 0;
  736.    }
  737.    this.incrvalue.onclick = function()
  738.    {
  739.       var t = this._parent;
  740.       t.object[t.controller] = math.min(t.object[t.maxvalue],t.object[t.controller] + t.step);
  741.       this.onenterframe = function()
  742.       {
  743.          if(!this.pressing)
  744.          {
  745.             delete this.onenterframe;
  746.          }
  747.          else if(this.timer + 500 < getTimer())
  748.          {
  749.             this.onpress();
  750.          }
  751.       };
  752.       this._parent.refresh();
  753.    };
  754.    this._children = ["incrValue","decrValue","scrollBar"];
  755.    this.createemptymovieclip("scrollbar",5);
  756.    this.scrollbar.__proto__ = kcomponent.prototype;
  757.    this.scrollbar._x = 2;
  758.    this.scrollbar._y = 2;
  759.    if(this.horizontal)
  760.    {
  761.       this.scrollbar.onpress = function()
  762.       {
  763.          this.startdrag(false,20,2,this._parent.object._width - this._width - 18,2);
  764.          this.dragging = true;
  765.       };
  766.    }
  767.    else
  768.    {
  769.       this.scrollbar.onpress = function()
  770.       {
  771.          this.startdrag(false,2,20,2,this._parent.object._height - this._height - 18);
  772.          this.dragging = true;
  773.       };
  774.    }
  775.    this.scrollbar.onrelease = function()
  776.    {
  777.       this.stopdrag();
  778.       this.dragging = false;
  779.       this._parent.kbarrefresh();
  780.    };
  781.    this.scrollbar.onreleaseoutside = function()
  782.    {
  783.       this.stopdrag();
  784.       this.dragging = false;
  785.       this._parent.kbarrefresh();
  786.    };
  787.    this.scrollbar.onmousemove = function()
  788.    {
  789.       var t = this._parent;
  790.       if(this.dragging and t.object[t.maxvalue] != t.minvalue)
  791.       {
  792.          if(t.horizontal)
  793.          {
  794.             var barspace = t.object._width - this._width - 38;
  795.             t.object[t.controller] = math.min(t.object[t.maxvalue],math.floor((this._x - 20) / (barspace / math.max(1,t.object[t.maxvalue] - t.minvalue + 1))) + t.minvalue);
  796.          }
  797.          else
  798.          {
  799.             var barspace = t.object._height - this._height - 38;
  800.             t.object[t.controller] = math.min(t.object[t.maxvalue],math.floor((this._y - 20) / (barspace / math.max(1,t.object[t.maxvalue] - t.minvalue + 1))) + t.minvalue);
  801.          }
  802.       }
  803.    };
  804.    this.scrollcheck = function()
  805.    {
  806.       if(!this.hidden)
  807.       {
  808.          var object = this.object;
  809.          var visible = object._visible;
  810.          var controller = object[this.controller];
  811.          var minvalue = this.minvalue;
  812.          var maxvalue = object[this.maxvalue];
  813.          var visiblesize = object[this.visiblesize];
  814.          var totalsize = object[this.totalsize];
  815.          var eventcheck = "/" + visible + "/" + controller + "/" + minvalue + "/" + maxvalue + "/" + visiblesize + "/" + totalsize;
  816.          if(object.eventcheck != eventcheck)
  817.          {
  818.             object.eventcheck = eventcheck;
  819.             this.krefresh();
  820.          }
  821.       }
  822.    };
  823.    setinterval(this,"scrollCheck",200);
  824. };
  825. kscrollbar.prototype.hide = function(hide)
  826. {
  827.    if(this.hidden != hide)
  828.    {
  829.       this.hidden = hide;
  830.       if(hide)
  831.       {
  832.          this._visible = false;
  833.       }
  834.       else
  835.       {
  836.          this.krefresh();
  837.       }
  838.    }
  839. };
  840. kscrollbar.prototype.kbarrefresh = function()
  841. {
  842.    if(this.horizontal)
  843.    {
  844.       this.incrbar._x = this._width - 22;
  845.       this.incrbar.kdrawtbox(this.scrollbar._x + this.scrollbar._width - 2 - this.incrbar._x,0,0,20);
  846.       this.decrbar.kdrawtbox(0,0,this.scrollbar._x - 20,20);
  847.    }
  848.    else
  849.    {
  850.       this.incrbar._y = this._height - 22;
  851.       this.incrbar.kdrawtbox(0,this.scrollbar._y + this.scrollbar._height - 2 - this.incrbar._y,20,0);
  852.       this.decrbar.kdrawtbox(0,0,20,this.scrollbar._y - 20);
  853.    }
  854. };
  855. kscrollbar.prototype.krefresh = function()
  856. {
  857.    if(!this.hidden)
  858.    {
  859.       if(!this.scrollbar.dragging)
  860.       {
  861.          var object = this.object;
  862.          var controller = this.controller;
  863.          var minvalue = this.minvalue;
  864.          var maxvalue = this.maxvalue;
  865.          var visiblesize = object[this.visiblesize];
  866.          var totalsize = object[this.totalsize];
  867.          if(this.horizontal)
  868.          {
  869.             var barsize = (object._width - 40) * math.min(visiblesize / totalsize,1);
  870.             if(barsize < 4)
  871.             {
  872.                barsize = 4;
  873.             }
  874.             var barspace = object._width - barsize - 40;
  875.             this._x = object._x;
  876.             this._y = object._y + object._height;
  877.             this.incrvalue._x = object._width - 18;
  878.             this.clear();
  879.             this.kdrawborderedboxfilled(0,0,object._width,20,this.style.border,this.style.scrolltrack);
  880.             this.scrollbar.clear();
  881.             this.scrollbar.style = this.style;
  882.             if(this.style.liquid)
  883.             {
  884.                this.scrollbar.kdrawliquidbox(0,0,barsize,16,this.style.scrollbar);
  885.             }
  886.             else
  887.             {
  888.                this.scrollbar.kdrawborderedboxfilled(0,0,barsize,16,this.style.border,this.style.scrollbar);
  889.             }
  890.             this.scrollbar._x = 20 + (object[controller] - minvalue) * barspace / math.max(1,object[maxvalue] - minvalue);
  891.             this.kbarrefresh();
  892.          }
  893.          else
  894.          {
  895.             var barsize = (object._height - 40) * math.min(visiblesize / totalsize,1);
  896.             if(barsize < 4)
  897.             {
  898.                barsize = 4;
  899.             }
  900.             var barspace = object._height - barsize - 40;
  901.             this._x = object._x + object._width;
  902.             this._y = object._y;
  903.             this.incrvalue._y = object._height - 18;
  904.             this.clear();
  905.             this.kdrawborderedboxfilled(0,0,20,object._height,this.style.border,this.style.scrolltrack);
  906.             this.scrollbar.clear();
  907.             this.scrollbar.style = this.style;
  908.             if(this.style.liquid)
  909.             {
  910.                this.scrollbar.kdrawliquidbox(0,0,16,barsize,this.style.scrollbar);
  911.             }
  912.             else
  913.             {
  914.                this.scrollbar.kdrawborderedboxfilled(0,0,16,barsize,this.style.border,this.style.scrollbar);
  915.             }
  916.             this.scrollbar._y = 20 + (object[controller] - minvalue) * barspace / math.max(1,object[maxvalue] - minvalue);
  917.             this.kbarrefresh();
  918.          }
  919.          this._visible = object._visible;
  920.       }
  921.    }
  922. };
  923. kscrollbar.prototype.reassign = function(object, controller, minvalue, maxvalue, visiblesize, totalsize, horizontal)
  924. {
  925.    this.object = eval(object);
  926.    this.controller = controller;
  927.    this.minvalue = minvalue;
  928.    this.maxvalue = maxvalue;
  929.    this.visiblesize = visiblesize;
  930.    this.totalsize = totalsize;
  931.    this.horizontal = horizontal;
  932.    this.krefresh();
  933. };
  934. kscrollbar.prototype.reassigntextfield = function(textfield, horizontal)
  935. {
  936.    if(horizontal)
  937.    {
  938.       this.reassign(textfield,"hscroll",0,"maxhscroll","_width","textWidth",true);
  939.       this.step = 10;
  940.    }
  941.    else
  942.    {
  943.       this.reassign(textfield,"scroll",1,"maxscroll","visibleSize","totalSize");
  944.       this.step = 1;
  945.    }
  946. };
  947. kobject.registerclass("KScrollBar",kscrollbar);
  948. _global.kcheckbox = function()
  949. {
  950.    this.kcinit();
  951.    this.init();
  952. };
  953. kcheckbox.prototype = new kcomponent();
  954. kcheckbox.prototype.width = 12;
  955. kcheckbox.prototype.init = function()
  956. {
  957.    this.style.sunken = true;
  958.    this.createtextfield("label",1,0,0,0,0);
  959.    this.label.autosize = "left";
  960.    this.label.selectable = false;
  961.    this.label.multiline = false;
  962.    this.checked = false;
  963.    this.createemptymovieclip("check",3);
  964.    this.check.__proto__ = kcomponent.prototype;
  965.    this.check.onpress = function()
  966.    {
  967.       this._parent.checked = !this._parent.checked;
  968.       this._parent.refresh();
  969.       this._parent.onchange();
  970.    };
  971.    this.krefresh();
  972. };
  973. kcheckbox.prototype.krefresh = function()
  974. {
  975.    this.check.clear();
  976.    this.check.style = this.style;
  977.    if(this.rightplacement)
  978.    {
  979.       this.check.kdrawborderedboxfilled(- this.width,0,0,this.width,this.style.border,this.style.background);
  980.       if(this.checked)
  981.       {
  982.          this.check.kdrawcheckmark(2 - this.width,2,- 2,this.width - 2,this.style.check);
  983.       }
  984.    }
  985.    else
  986.    {
  987.       this.check.kdrawborderedboxfilled(0,0,this.width,this.width,this.style.border,this.style.background);
  988.       if(this.checked)
  989.       {
  990.          this.check.kdrawcheckmark(2,2,this.width - 2,this.width - 2,this.style.check);
  991.       }
  992.    }
  993.    this.setlabel(this.label.text);
  994. };
  995. kcheckbox.prototype.setlabel = function(label)
  996. {
  997.    var textformat = new textformat();
  998.    textformat.color = this.style.textcolor;
  999.    textformat.font = this.style.textfont;
  1000.    textformat.size = this.style.textsize;
  1001.    this.label.setnewtextformat(textformat);
  1002.    this.label.text = label;
  1003.    this.label._y = this.width - this.label.textheight;
  1004.    if(this.rightplacement)
  1005.    {
  1006.       this.label._x = - this.width - 8 - this.label.textwidth;
  1007.    }
  1008.    else
  1009.    {
  1010.       this.label._x = this.width + 4;
  1011.    }
  1012. };
  1013. kcheckbox.prototype.setlabelplacement = function(placement)
  1014. {
  1015.    if(placement.tolowercase() == "right")
  1016.    {
  1017.       this.rightplacement = true;
  1018.    }
  1019.    else
  1020.    {
  1021.       this.rightplacement = false;
  1022.    }
  1023.    this.krefresh();
  1024. };
  1025. kcheckbox.prototype.getlabel = function()
  1026. {
  1027.    return this.label.text;
  1028. };
  1029. kcheckbox.prototype.setvalue = function(boolean)
  1030. {
  1031.    var change = this.checked != boolean;
  1032.    this.checked = boolean;
  1033.    this.refresh();
  1034.    if(change)
  1035.    {
  1036.       this.onchange();
  1037.    }
  1038. };
  1039. kcheckbox.prototype.getvalue = function()
  1040. {
  1041.    return this.checked;
  1042. };
  1043. kobject.registerclass("KCheckBox",kcheckbox);
  1044. _global.ksublist = function()
  1045. {
  1046.    this.kcinit();
  1047.    this.init();
  1048. };
  1049. ksublist.prototype = new kcomponent();
  1050. ksublist.prototype.setscrollposition = function(scrollposition)
  1051. {
  1052.    this.topitem = scrollposition;
  1053.    this.refresh();
  1054. };
  1055. ksublist.prototype.getscrollposition = function()
  1056. {
  1057.    return this.topitem;
  1058. };
  1059. ksublist.prototype.getmaxscroll = function()
  1060. {
  1061.    return math.max(0,this._parent.getlength() - this.size);
  1062. };
  1063. ksublist.prototype.setrowcount = function(size)
  1064. {
  1065.    this.size = size;
  1066.    this.refresh();
  1067. };
  1068. ksublist.prototype.getrowcount = function()
  1069. {
  1070.    return this.size;
  1071. };
  1072. ksublist.prototype.getlength = function()
  1073. {
  1074.    return this._parent.getlength();
  1075. };
  1076. ksublist.prototype.init = function()
  1077. {
  1078.    this.setlineheight();
  1079.    this.topitem = 0;
  1080.    this.createemptymovieclip("hb",1);
  1081.    this.hb.__proto__ = kcomponent.prototype;
  1082.    this.hb._alpha = 15;
  1083.    this.createtextfield("display",2,2,0,0,0);
  1084.    this.display.html = true;
  1085.    this.display.selectable = false;
  1086.    this.display.multiline = true;
  1087.    this.addproperty("scroll",this.getscrollposition,this.setscrollposition);
  1088.    this.addproperty("maxscroll",this.getmaxscroll,null);
  1089.    this.addproperty("rowcount",this.getrowcount,null);
  1090.    this.addproperty("length",this.getlength,null);
  1091.    this.addproperty("_height",this.getheight,null);
  1092.    this.addproperty("_width",this.getwidth,null);
  1093. };
  1094. ksublist.prototype.onrollover = function()
  1095. {
  1096.    this.hb.y = null;
  1097.    this.onmousemove = this.mousemover;
  1098. };
  1099. ksublist.prototype.mousemover = function()
  1100. {
  1101.    var point = new object();
  1102.    point.x = _root._xmouse;
  1103.    point.y = _root._ymouse;
  1104.    this.globaltolocal(point);
  1105.    var lineheight = this.style.lineheight + 2;
  1106.    var i = this.topitem + math.floor((point.y - 2) / lineheight);
  1107.    var y = (i - this.topitem) * lineheight;
  1108.    if(y != this.hb.y)
  1109.    {
  1110.       this.hb.y = y;
  1111.       this.hb.clear();
  1112.       if(i >= this.topitem and i < this.topitem + this.size and i < this.getlength())
  1113.       {
  1114.          this.hb.kdrawboxfilled(2,2 + y,this.width - 1,lineheight + y + 1,!!this._parent.itemlist[i].selected ? this.style.background : this.style.selection);
  1115.          this._tooltip = this._parent.itemlist[i]._tooltip;
  1116.       }
  1117.    }
  1118. };
  1119. ksublist.prototype.onrollout = function()
  1120. {
  1121.    this.onmousemove = null;
  1122.    this.hb.clear();
  1123. };
  1124. ksublist.prototype.onpress = function()
  1125. {
  1126.    var point = new object();
  1127.    point.x = _root._xmouse;
  1128.    point.y = _root._ymouse;
  1129.    this.globaltolocal(point);
  1130.    var i = this.topitem + math.floor((point.y - 2) / (this.style.lineheight + 2));
  1131.    if(i >= this.topitem and i < this.topitem + this.size and i < this.getlength())
  1132.    {
  1133.       if(!this.multiple)
  1134.       {
  1135.          if(this.selected != i)
  1136.          {
  1137.             this._parent.itemlist[this.selected].selected = false;
  1138.             this.selected = i;
  1139.             this._parent.itemlist[this.selected].selected = true;
  1140.             this.refresh();
  1141.             this._parent.onchange();
  1142.          }
  1143.       }
  1144.       else
  1145.       {
  1146.          this._parent.itemlist[i].selected = !this._parent.itemlist[i].selected;
  1147.          this.refresh();
  1148.          this._parent.onchange();
  1149.       }
  1150.    }
  1151. };
  1152. ksublist.prototype.khtmlcolor = function(color)
  1153. {
  1154.    if(typeof color == "number")
  1155.    {
  1156.       return "#" + color.tostring(16);
  1157.    }
  1158.    return "#" + color.substr(color.indexof("x") + 1);
  1159. };
  1160. ksublist.prototype.krefresh = function()
  1161. {
  1162.    if(this._parent.width < 40)
  1163.    {
  1164.       this._parent.width = 40;
  1165.    }
  1166.    this.size = math.max(this.size,math.ceil(47 / (this.style.lineheight + 2)));
  1167.    if(this.autohide and this.size >= this.getlength())
  1168.    {
  1169.       this.width = this._parent.width;
  1170.       this._parent.vscroller.hide(true);
  1171.    }
  1172.    else
  1173.    {
  1174.       this.width = this._parent.width - 20;
  1175.       this._parent.vscroller.hide(false);
  1176.    }
  1177.    var html = "<TEXTFORMAT LEADING=\"2\"><FONT FACE=\"" + this._parent.style.textfont + "\" SIZE=\"" + this._parent.style.textsize + "\">";
  1178.    var i = this.topitem;
  1179.    while(i < this.topitem + this.size)
  1180.    {
  1181.       html += "<FONT COLOR=\"" + this.khtmlcolor(!!this._parent.itemlist[i].selected ? this.style.textselected : this.style.textcolor) + "\">";
  1182.       var label = this._parent.getitemlabel(i);
  1183.       if(typeof label == "undefined")
  1184.       {
  1185.          label = "";
  1186.       }
  1187.       html += label + "</FONT><BR>";
  1188.       i++;
  1189.    }
  1190.    html += "</FONT></TEXTFORMAT>";
  1191.    this.display.htmltext = html;
  1192.    this.display._width = this.width - 1;
  1193.    var lineheight = this.style.lineheight + 2;
  1194.    this.height = this.size * lineheight + 3;
  1195.    this.display._height = this.height;
  1196.    this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.background);
  1197.    if(this._parent.vscroller.hidden)
  1198.    {
  1199.       var i = 0;
  1200.       while(i < this.size)
  1201.       {
  1202.          if(this._parent.itemlist[this.topitem + i].selected)
  1203.          {
  1204.             this.kdrawborderedboxfilled(2,i * lineheight + 2,this.width - 2,(i + 1) * lineheight + 1,this.style.border,this.style.selection);
  1205.          }
  1206.          i++;
  1207.       }
  1208.    }
  1209.    else
  1210.    {
  1211.       this.kdrawboxfilled(1,1,this.width,this.height - 1,this.style.background);
  1212.       var i = 0;
  1213.       while(i < this.size)
  1214.       {
  1215.          if(this._parent.itemlist[this.topitem + i].selected)
  1216.          {
  1217.             this.kdrawborderedboxfilled(2,i * lineheight + 2,this.width - 1,(i + 1) * lineheight + 1,this.style.border,this.style.selection);
  1218.          }
  1219.          i++;
  1220.       }
  1221.    }
  1222.    this._parent.vscroller.clearrefresh();
  1223. };
  1224. kobject.registerclass("KSubList",ksublist);
  1225. _global.klistbox = function()
  1226. {
  1227.    this.kcinit();
  1228.    this.init();
  1229. };
  1230. klistbox.prototype = new kdatacomponent();
  1231. klistbox.prototype.getvalue = function()
  1232. {
  1233.    var i = this.getselecteditem();
  1234.    if(typeof i.value != "undefined")
  1235.    {
  1236.       return i.value;
  1237.    }
  1238.    return i.label;
  1239. };
  1240. klistbox.prototype.getselectedindex = function()
  1241. {
  1242.    if(!this.list.multiple)
  1243.    {
  1244.       return this.list.selected;
  1245.    }
  1246.    return this.getselectedindices()[0];
  1247. };
  1248. klistbox.prototype.getselectedindices = function()
  1249. {
  1250.    var selected = new array();
  1251.    var i = 0;
  1252.    while(i < this.itemlist.length)
  1253.    {
  1254.       if(this.itemlist[i].selected)
  1255.       {
  1256.          selected.push(i);
  1257.       }
  1258.       i++;
  1259.    }
  1260.    return selected;
  1261. };
  1262. klistbox.prototype.getselecteditem = function()
  1263. {
  1264.    if(!this.list.multiple)
  1265.    {
  1266.       return this.itemlist[this.list.selected];
  1267.    }
  1268.    return this.getselecteditems()[0];
  1269. };
  1270. klistbox.prototype.setselectedindex = function(i)
  1271. {
  1272.    if(i < this.getlength())
  1273.    {
  1274.       this.itemlist[this.list.selected].selected = false;
  1275.       this.itemlist[i].selected = true;
  1276.       this.list.selected = i;
  1277.       this.list.refresh();
  1278.       this.onchange();
  1279.    }
  1280. };
  1281. klistbox.prototype.getselecteditems = function()
  1282. {
  1283.    var selected = new array();
  1284.    var i = 0;
  1285.    while(i < this.itemlist.length)
  1286.    {
  1287.       if(this.itemlist[i].selected)
  1288.       {
  1289.          selected.push(this.itemlist[i]);
  1290.       }
  1291.       i++;
  1292.    }
  1293.    return selected;
  1294. };
  1295. klistbox.prototype.setselectedindices = function(itemarray)
  1296. {
  1297.    this.setselectmultiple(true);
  1298.    var i = 0;
  1299.    while(i < itemarray.length)
  1300.    {
  1301.       if(itemarray[i] < this.itemlist.length)
  1302.       {
  1303.          this.itemlist[itemarray[i]].selected = true;
  1304.       }
  1305.       i++;
  1306.    }
  1307.    this.list.refresh();
  1308.    this.onchange();
  1309. };
  1310. klistbox.prototype.setscrollposition = function(scrollposition)
  1311. {
  1312.    this.list.setscrollposition(scrollposition);
  1313. };
  1314. klistbox.prototype.getscrollposition = function()
  1315. {
  1316.    return this.list.getscrollposition();
  1317. };
  1318. klistbox.prototype.setselectmultiple = function(multiple)
  1319. {
  1320.    this.list.multiple = multiple;
  1321.    if(!multiple)
  1322.    {
  1323.       var i = 0;
  1324.       while(i < this.itemlist.length)
  1325.       {
  1326.          this.itemlist[i].selected = false;
  1327.          i++;
  1328.       }
  1329.    }
  1330. };
  1331. klistbox.prototype.getselectmultiple = function()
  1332. {
  1333.    return this.list.multiple;
  1334. };
  1335. klistbox.prototype.setrowcount = function(size)
  1336. {
  1337.    this.list.setrowcount(size);
  1338. };
  1339. klistbox.prototype.getrowcount = function()
  1340. {
  1341.    return this.list.getrowcount();
  1342. };
  1343. klistbox.prototype.setautohidescrollbar = function(autohide)
  1344. {
  1345.    this.list.autohide = autohide;
  1346. };
  1347. klistbox.prototype.init = function()
  1348. {
  1349.    this.selectedarray = [];
  1350.    this.kattachmovie("KSubList","list",1);
  1351.    this.kattachmovie("KScrollBar","vScroller",2,{object:eval(this.list),controller:"scroll",minvalue:0,maxvalue:"maxscroll",visiblesize:"rowcount",totalsize:"length"});
  1352.    this.vscroller.onenterframe = null;
  1353.    this._children = ["list","vScroller"];
  1354.    this.list.size = this.rowcount;
  1355.    this.krefresh();
  1356. };
  1357. klistbox.prototype.krefresh = function()
  1358. {
  1359.    this.list.refresh();
  1360. };
  1361. kobject.registerclass("KListBox",klistbox);
  1362. _global.ksubpane = function()
  1363. {
  1364.    this.kcinit();
  1365.    this.init();
  1366. };
  1367. ksubpane.prototype = new kcomponent();
  1368. ksubpane.prototype.init = function()
  1369. {
  1370.    this.createemptymovieclip("content",1);
  1371.    this.content.__proto__ = kcomponent.prototype;
  1372.    this.createemptymovieclip("mask",2);
  1373.    this.mask.__proto__ = kcomponent.prototype;
  1374.    this.mask._visible = false;
  1375.    this.content.setmask(this.mask);
  1376.    this.children = ["content"];
  1377.    this.krefresh();
  1378.    this.addproperty("_height",this.getheight,null);
  1379.    this.addproperty("_width",this.getwidth,null);
  1380.    this.addproperty("vscroll",this.getvscroll,this.setvscroll);
  1381.    this.addproperty("hscroll",this.gethscroll,this.sethscroll);
  1382.    this.addproperty("maxvscroll",this.getmaxvscroll,null);
  1383.    this.addproperty("maxhscroll",this.getmaxhscroll,null);
  1384.    this.addproperty("contentheight",this.getcontentheight,null);
  1385.    this.addproperty("contentwidth",this.getcontentwidth,null);
  1386. };
  1387. ksubpane.prototype.krefresh = function()
  1388. {
  1389.    this.clear();
  1390.    mask.clear();
  1391.    this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.scrolltrack);
  1392.    this.kdrawboxfilled(1,1,this.width,this.height,this.style.background);
  1393.    this.mask.kdrawboxfilled(1,1,this.width,this.height,0);
  1394. };
  1395. ksubpane.prototype.loadcontent = function(filename, hs, vs)
  1396. {
  1397.    this.hs = hs;
  1398.    this.vs = vs;
  1399.    delete this.content;
  1400.    delete this.loadbar;
  1401.    this.createemptymovieclip("content",1);
  1402.    this.content.__proto__ = kcomponent.prototype;
  1403.    this.createemptymovieclip("loadbar",7);
  1404.    this.loadbar.__proto__ = kcomponent.prototype;
  1405.    this.loadbar.style = this.style;
  1406.    this.loadbar.kdrawborderedboxfilled(this.width * 0.20000000298023224,this.height * 0.4000000059604645,this.width * 0.800000011920929,this.height * 0.6000000238418579,this.style.border,this.style.scrolltrack);
  1407.    this.loadbar.kdrawborderedboxfilled(2 + this.width * 0.20000000298023224,2 + this.height * 0.4000000059604645,6 + this.width * 0.20000000298023224,this.height * 0.6000000238418579 - 2,this.style.border,this.style.scrolltrack);
  1408.    this.content.loadmovie(filename);
  1409.    this.onenterframe = function()
  1410.    {
  1411.       if(0 < this.content._width * this.content._height)
  1412.       {
  1413.          if(0 < this.hs)
  1414.          {
  1415.             this.hscroll = this.hs;
  1416.          }
  1417.          if(0 < this.vs)
  1418.          {
  1419.             this.vscroll = this.vs;
  1420.          }
  1421.          this.onenterframe = null;
  1422.          this.loadbar.removemovieclip();
  1423.          this.content.setmask(this.mask);
  1424.          this.content.enabled = this.enabled;
  1425.          if(this._parent.allowdragging)
  1426.          {
  1427.             this.content.onpress = function()
  1428.             {
  1429.                this.startdrag(false,0,0,- this._parent.getmaxhscroll(),- this._parent.getmaxvscroll());
  1430.                this.dragging = true;
  1431.             };
  1432.             this.content.onrelease = function()
  1433.             {
  1434.                this.dragging = false;
  1435.                this.stopdrag();
  1436.             };
  1437.             this.content.onreleaseoutside = function()
  1438.             {
  1439.                this.dragging = false;
  1440.                this.stopdrag();
  1441.             };
  1442.          }
  1443.          this.clearrefresh();
  1444.       }
  1445.       else
  1446.       {
  1447.          var lcw = this.content.getbytesloaded();
  1448.          if(0 < lcw)
  1449.          {
  1450.             lcw = (this.width * 0.6000000238418579 - 8) * lcw / this.content.getbytestotal();
  1451.             if(lcw != this.lcw)
  1452.             {
  1453.                this.loadbar.kdrawborderedboxfilled(2 + this.width * 0.20000000298023224,2 + this.height * 0.4000000059604645,6 + this.width * 0.20000000298023224 + lcw,this.height * 0.6000000238418579 - 2,this.style.border,this.style.scrolltrack);
  1454.                this.lcw = lcw;
  1455.             }
  1456.          }
  1457.       }
  1458.    };
  1459.    this.refresh();
  1460. };
  1461. ksubpane.prototype.setvscroll = function(vscroll)
  1462. {
  1463.    this._vscroll = vscroll;
  1464.    this.content._y = - vscroll;
  1465. };
  1466. ksubpane.prototype.getvscroll = function()
  1467. {
  1468.    this._vscroll = - this.content._y;
  1469.    return this._vscroll;
  1470. };
  1471. ksubpane.prototype.sethscroll = function(hscroll)
  1472. {
  1473.    this._hscroll = hscroll;
  1474.    this.content._x = - hscroll;
  1475. };
  1476. ksubpane.prototype.gethscroll = function()
  1477. {
  1478.    this._hscroll = - this.content._x;
  1479.    return this._hscroll;
  1480. };
  1481. ksubpane.prototype.getmaxvscroll = function()
  1482. {
  1483.    return math.max(0,this.content._height - this.height);
  1484. };
  1485. ksubpane.prototype.getmaxhscroll = function()
  1486. {
  1487.    return math.max(0,this.content._width - this.width);
  1488. };
  1489. ksubpane.prototype.getcontentheight = function()
  1490. {
  1491.    return this.content._height;
  1492. };
  1493. ksubpane.prototype.getcontentwidth = function()
  1494. {
  1495.    return this.content._width;
  1496. };
  1497. kobject.registerclass("KSubPane",ksubpane);
  1498. _global.kscrollpane = function()
  1499. {
  1500.    this.kcinit();
  1501.    this.init();
  1502. };
  1503. kscrollpane.prototype = new kcomponent();
  1504. kscrollpane.prototype.allowdragging = false;
  1505. kscrollpane.prototype.init = function()
  1506. {
  1507.    if(this.width < 65)
  1508.    {
  1509.       this.width = 65;
  1510.    }
  1511.    if(this.height < 65)
  1512.    {
  1513.       this.height = 65;
  1514.    }
  1515.    this.kattachmovie("KSubPane","pane",1,{width:this.width - 20,height:this.height - 20,_x:0,_y:0});
  1516.    this.kattachmovie("KScrollBar","vScroller",2,{object:eval(this.pane),controller:"vscroll",minvalue:0,maxvalue:"maxvscroll",visiblesize:"_height",totalsize:"contentheight",horizontal:false,step:10});
  1517.    this.kattachmovie("KScrollBar","hScroller",3,{object:eval(this.pane),controller:"hscroll",minvalue:0,maxvalue:"maxhscroll",visiblesize:"_width",totalsize:"contentwidth",horizontal:true,step:10});
  1518.    this._children = ["pane","vScroller","hScroller"];
  1519.    this.content = this.pane.content;
  1520.    this.krefresh();
  1521. };
  1522. kscrollpane.prototype.krefresh = function()
  1523. {
  1524.    if(this.width < 65)
  1525.    {
  1526.       this.width = 65;
  1527.    }
  1528.    if(this.height < 65)
  1529.    {
  1530.       this.height = 65;
  1531.    }
  1532.    this.clear();
  1533.    this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.scrolltrack);
  1534.    this.pane.setsize(this.width - 20,this.height - 20);
  1535. };
  1536. kscrollpane.prototype.loadcontent = function(filename, hs, vs)
  1537. {
  1538.    this.pane.loadcontent(filename,hs,vs);
  1539. };
  1540. kobject.registerclass("KScrollPane",kscrollpane);
  1541. _global.kpushbutton = function()
  1542. {
  1543.    this.kcinit();
  1544.    this.init();
  1545. };
  1546. kpushbutton.prototype = new kcomponent();
  1547. kpushbutton.prototype.init = function()
  1548. {
  1549.    this.createtextfield("label",1,0,0,0,0);
  1550.    this.label.autosize = "left";
  1551.    this.label.selectable = false;
  1552.    this.label.multiline = false;
  1553.    this.refresh();
  1554. };
  1555. kpushbutton.prototype.onpress = function()
  1556. {
  1557.    this.pressing = true;
  1558.    this.refresh();
  1559.    this.onclick();
  1560. };
  1561. kpushbutton.prototype.onrelease = function()
  1562. {
  1563.    this.pressing = false;
  1564.    this.refresh();
  1565. };
  1566. kpushbutton.prototype.onreleaseoutside = function()
  1567. {
  1568.    this.pressing = false;
  1569.    this.refresh();
  1570. };
  1571. kpushbutton.prototype.onrollover = function()
  1572. {
  1573.    this.rover = true;
  1574.    this.refresh();
  1575. };
  1576. kpushbutton.prototype.onrollout = function()
  1577. {
  1578.    this.rover = false;
  1579.    this.refresh();
  1580. };
  1581. kpushbutton.prototype.krefresh = function()
  1582. {
  1583.    var color = this.style.face;
  1584.    this.clear();
  1585.    if(this.style.liquid)
  1586.    {
  1587.       this.kdrawliquidbox(0,0,this.width,this.height,color);
  1588.    }
  1589.    else
  1590.    {
  1591.       this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,color);
  1592.    }
  1593.    this.setlabel(this.label.text);
  1594. };
  1595. kpushbutton.prototype.setautoresize = function(boolean)
  1596. {
  1597.    this.buttonresize = boolean;
  1598. };
  1599. kpushbutton.prototype.setlabel = function(label)
  1600. {
  1601.    var textformat = new textformat();
  1602.    textformat.color = this.style.textcolor;
  1603.    textformat.font = this.style.textfont;
  1604.    textformat.size = this.style.textsize;
  1605.    this.label.setnewtextformat(textformat);
  1606.    this.label.text = label;
  1607.    this.label._x = this.width / 2 - this.label.textwidth / 2 - 2;
  1608.    this.label._y = this.height / 2 - this.label.textheight / 2 - 2;
  1609.    if(this.buttonresize)
  1610.    {
  1611.       this.setsize(this.label.textwidth + 10,this.label.textheight + 10);
  1612.    }
  1613. };
  1614. kpushbutton.prototype.getlabel = function()
  1615. {
  1616.    return this.label.text;
  1617. };
  1618. kobject.registerclass("KPushButton",kpushbutton);
  1619. ko = _global.ktooltip = object.ktooltip = new object();
  1620. ko.iid = "nop";
  1621. ko.style = new kstyleformat();
  1622. ko.setstyle = function(styleformat)
  1623. {
  1624.    this.style.getpropertiesfrom(styleformat);
  1625. };
  1626. ko.setstyleproperty = function(styleproperty, value)
  1627. {
  1628.    this.style[styleproperty] = value;
  1629. };
  1630. ko.cleartip = function()
  1631. {
  1632.    clearinterval(this.iid);
  1633.    this.iid = "nop";
  1634.    _root.ktooltiptf.removetextfield();
  1635. };
  1636. ko.checktip = function()
  1637. {
  1638.    clearinterval(this.iid);
  1639.    this.iid = setinterval(this,"clearTip",5500);
  1640.    var mc = _root;
  1641.    var tip = mc._tooltip;
  1642.    var eoc = false;
  1643.    while(!eoc)
  1644.    {
  1645.       var cnt = true;
  1646.       var smc = mc;
  1647.       var p;
  1648.       for(p in "smc")
  1649.       {
  1650.          if(cnt and smc[p]._parent == smc and smc[p].hittest(_root._xmouse,_root._ymouse,true))
  1651.          {
  1652.             mc = mc[p];
  1653.             cnt = false;
  1654.             if(mc._tooltip.length)
  1655.             {
  1656.                tip = mc._tooltip;
  1657.             }
  1658.          }
  1659.       }
  1660.       if(cnt == true)
  1661.       {
  1662.          eoc = true;
  1663.       }
  1664.    }
  1665.    if(tip.length)
  1666.    {
  1667.       var d = 16384;
  1668.       var i;
  1669.       for(i in "_root")
  1670.       {
  1671.          if(this[i].getdepth() != null)
  1672.          {
  1673.             d = math.max(d,this[i].getdepth());
  1674.          }
  1675.       }
  1676.       d++;
  1677.       _root.createtextfield("KToolTipTF",d,0,0,0,0);
  1678.       var k = _root.ktooltiptf;
  1679.       var s = this.style;
  1680.       var f = new textformat();
  1681.       f.font = s.textfont;
  1682.       f.size = s.textsize;
  1683.       f.color = s.textcolor;
  1684.       k.setnewtextformat(f);
  1685.       k.text = tip;
  1686.       k._x = _root._xmouse;
  1687.       k._x = math.min(stage.width - k.textwidth - 8,k._x);
  1688.       k._y = _root._ymouse + 22;
  1689.       if(stage.height < k._y + k.textheight + 6)
  1690.       {
  1691.          k._y = _root._ymouse - k.textheight - 6;
  1692.       }
  1693.       k.autosize = "left";
  1694.       k.background = true;
  1695.       k.border = true;
  1696.       k.selectable = false;
  1697.       k.backgroundcolor = s.background;
  1698.       k.bordercolor = s.border;
  1699.    }
  1700. };
  1701. ko.activate = function()
  1702. {
  1703.    this.onmousemove = function()
  1704.    {
  1705.       _root.ktooltiptf.removetextfield();
  1706.       if(this.iid != "nop")
  1707.       {
  1708.          clearinterval(this.iid);
  1709.       }
  1710.       this.iid = setinterval(this,"checkTip",750);
  1711.    };
  1712.    mouse.addlistener(this);
  1713. };
  1714. delete ko;
  1715. movieclip.prototype.createkcheckbox = function(instancename, depth, initobject)
  1716. {
  1717.    this.kattachmovie("KCheckBox",instancename,depth,initobject);
  1718. };
  1719. movieclip.prototype.createklistbox = function(instancename, depth, initobject)
  1720. {
  1721.    this.kattachmovie("KListBox",instancename,depth,initobject);
  1722. };
  1723. movieclip.prototype.createkpushbutton = function(instancename, depth, initobject)
  1724. {
  1725.    this.kattachmovie("KPushButton",instancename,depth,initobject);
  1726. };
  1727. movieclip.prototype.createkscrollbar = function(instancename, depth, textfield, horizontal)
  1728. {
  1729.    if(horizontal)
  1730.    {
  1731.       this.kattachmovie("KScrollBar",instancename,depth,{object:eval(textfield),controller:"hscroll",minvalue:0,maxvalue:"maxhscroll",visiblesize:"_width",totalsize:"textWidth",horizontal:true,step:10});
  1732.    }
  1733.    else
  1734.    {
  1735.       this.kattachmovie("KScrollBar",instancename,depth,{object:eval(textfield),controller:"scroll",minvalue:1,maxvalue:"maxscroll",visiblesize:"visibleSize",totalsize:"totalSize"});
  1736.    }
  1737. };
  1738. movieclip.prototype.createkscrollpane = function(instancename, depth, initobject)
  1739. {
  1740.    this.kattachmovie("KScrollPane",instancename,depth,initobject);
  1741. };
  1742. object.$protect();
  1743. movieclip.prototype.$protect();
  1744. textfield.prototype.$protect();
  1745. assetpropflags(_global,null,7);
  1746. textfield.prototype.addproperty("visibleSize",textfield.prototype.getvisiblesize,null);
  1747. textfield.prototype.addproperty("totalSize",textfield.prototype.gettotalsize,null);
  1748.